/*
 * Copyright 2009 Armando Blancas
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package taskgraph.ports;

import java.io.IOException;

/**
 * An output interface to an Float Channel.
 * 
 * @author Armando Blancas
 */
public interface FloatOutputPort extends Port {
	
    /**
     * Writes a float to this output pipe.
     * 
     * @param f The {@code float} value to be written.
     * @return  This output port.
     * @throws IOException  If an I/O error occurs.
     */
	FloatOutputPort write(float f) throws IOException;

    /**
     * Writes to the channel all the floats in array {@code f}.
     * If {@code f} is {@code null}, a {@code NullPointerException} is thrown. 
     * If {@code f.length} is zero, then no floats are written. Otherwise, 
     * the float {@code f[0]} is written first, then {@code f[1]}, and 
     * so on; the last float written is {@code f[f.length-1]}.
     *
     * @param f The {@code float} array to write.
     * @return  This output port.
     * @throws IOException If an I/O error occurs.
     */
	FloatOutputPort write(float[] f) throws IOException;

    /**
     * Writes <code>len</code> floats from array <code>f</code>, in order, 
     * to the channel. If <code>f</code> is <code>null</code>, a <code>
     * NullPointerException</code> is thrown.  If <code>off</code> is negative,
     * or <code>len</code> is negative, or <code>off+len</code> is greater than
     * the length of the array <code>f</code>, then an <code>
     * IndexOutOfBoundsException</code> is thrown.  If <code>len</code> is zero,
     * then no floats are written. Otherwise, the float 
     * <code>f[off]</code> is written first, then <code>f[off+1]</code>, and so
     * on; the last float  written is <code>f[off+len-1]</code>.
     *
     * @param f The {@code float} array with the data to write.
     * @param off The start offset in the array.
     * @param len The number of floats to write.
     * @return  This output port.
     * @throws IOException If an I/O error occurs.
     */
	FloatOutputPort write(float[] f, int off, int len) throws IOException;

}
